<template>
  <div class="add-enterprise">
    <header class="add-header">
      <div class="left">
        <span
          class="arrow"
          @click="$router.back()"
        ><i class="el-icon-arrow-left" />返回</span>
        <span>|</span>
        <span>警告详情</span>
      </div>
      <div class="right">黑马程序员</div>
    </header>
    <main class="add-main">
      <div class="form-container">
        <div class="title">告警详情</div>
        <div class="form">
          <el-form label-width="100px" :model="addForm">
            <el-form-item label="一体杆名称:" prop="poleName">
              {{ addForm.poleName }}
            </el-form-item>
            <el-form-item label="一体杆编号:" prop="poleNumber">
              {{ addForm.poleNumber }}
            </el-form-item>
            <el-form-item label="警告时间:" prop="warningTime">
              {{ addForm.warningTime }}
            </el-form-item>
            <el-form-item label="警告区域:" prop="areaName">
              {{ addForm.areaName }}
            </el-form-item>
            <el-form-item label="故障类型:" prop="errorType">
              {{ addForm.errorType }}
            </el-form-item>
            <el-form-item label="处置状态:" prop="handleStatus">
              {{ addForm.handleStatus }}
            </el-form-item>

          </el-form>
        </div>
      </div>
    </main>

    <main class="add-main">
      <div class="form-container">
        <div class="title">告警处理</div>
        <div class="form">
          <el-form label-width="100px" :model="addForm">
            <el-form-item label="处理人:" prop="handleUser">
              {{ addForm.handleUser }}
            </el-form-item>
            <el-form-item label="联系方式:" prop="phonenumber">
              {{ addForm.poleNumber }}
            </el-form-item>
            <el-form-item label="处理结果:" prop="handleResult">
              {{ addForm.handleResult }}
            </el-form-item>
            <el-form-item label="完成时间:" prop="handleTime">
              {{ addForm.handleTime }}
            </el-form-item>

          </el-form>
        </div>
      </div>
    </main>

    <footer class="add-footer">
      <div class="btn-container">
        <el-button>重置</el-button>
        <el-button type="primary">确定</el-button>
      </div>
    </footer>
  </div>
</template>

<script>
import { datilWarningAPI } from '@/api/warning'
export default {
  data() {
    return {
      addForm: {
        id: '',
        warningTime: '',
        errorType: '',
        poleName: '',
        poleNumber: '',
        areaName: '',
        handleStatus: '',
        handleUser: '',
        phonenumber: '',
        handleResult: '',
        handleTime: ''

      }
    }
  },
  computed: {
    id() {
      return this.$route.query.id
    }
  },
  mounted() {
    this.getWarningDetail()
  },
  methods: {
    async getWarningDetail() {
      const res = await datilWarningAPI(this.id)
      // 解构赋值
      const { id, warningTime, errorType, poleName, poleNumber, areaName, handleStatus, handleUser, phonenumber, handleResult, handleTime
      } = res.data
      this.addForm = { id, warningTime, errorType, poleName, poleNumber, areaName, handleStatus, handleUser, phonenumber, handleResult, handleTime
      }
    }
  }
}
</script>

<style scoped lang="scss">
.add-enterprise {
  background-color: #f4f6f8;
  height: 100vh;

  .add-header {
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    height: 64px;
    line-height: 64px;
    font-size: 16px;
    font-weight: bold;
    background-color: #fff;

    .left {
      span {
        margin-right: 4px;
      }
      .arrow {
        cursor: pointer;
      }
    }

    .right {
      text-align: right;
    }
  }

  .add-main {
    background: #f4f6f8;
    padding: 20px 130px;

    .form-container {
      background-color: #fff;
      .title {
        height: 60px;
        line-height: 60px;
        padding-left: 20px;
      }
      .form {
        margin-bottom: 20px;
        padding: 20px 65px 24px;
        .el-form {
          display: flex;
          flex-wrap: wrap;
          .el-form-item {
            width: 50%;
          }
        }
      }
    }
  }

  .add-footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 24px 50px;
    color: #000000d9;
    font-size: 14px;
    background: #fff;
    text-align: center;
  }
}
</style>

